package com.yang.Offer;

public class Offer10_2 {
}
/*
* 青蛙跳台阶，和斐波那契数列一样，只不过 当 台阶为0时，返回1
*
* */
class SolutionOffer10_2 {
    public int numWays(int n) {
        if (n == 2){
            return 2;
        }
        if (n < 2){
            return 1;
        }

        int step1 = 1;
        int step2 = 1;
        int stepN = 0;
        for(int i = 2; i<=n; i++){
            stepN = (step1 + step2) % 1000000007;
            step2 = step1;
            step1 = stepN;
        }
        return stepN;
    }
}
